package com.zyw.controller.financial;


import com.zyw.entity.Order;
import com.zyw.from.FinancialFrom;
import com.zyw.from.OrderFrom;
import com.zyw.service.financial.FinancialManagementService;
import com.zyw.vo.FinancialManagementVo;
import com.zyw.vo.LayUITableVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@Slf4j
@RequestMapping("/financial/management")
public class FinancialManagementController {


    @Autowired
    public FinancialManagementService financialManagementService;

    //菜品类别展示
    @GetMapping("/index")
    public String index(Model model){


        return "financial/management/index";

    }

    //获取菜品类别信息
    @GetMapping("/list")
    @ResponseBody
    public LayUITableVO<List<FinancialManagementVo>> list (@RequestParam(defaultValue = "1") Integer page,
                                                           @RequestParam(defaultValue = "10") Integer limit,
                                                           FinancialFrom from){

        Map<String ,Object> map = new HashMap<>();
        map.put("page",page);
        map.put("limit",limit);
        map.put("from",from);
        LayUITableVO< List<FinancialManagementVo>> vo = financialManagementService.findPage(map);


        return vo;
    }


}
